﻿using AbpVnext_Module.Dto;
using AbpVnext_Module.Iservice;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;

namespace AbpVnext_Module.Controllers
{
    [Route("api/[controller]/mobile/monile")]
    [ApiController]
    public class ProductController : AbpController
    {
        public IProductService productService { get; set; }

        public IAuthorizationService _authorizationService { get; set; }

        public ProductController()
        {

        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        //基于特性鉴权 添加多个特性时候 需要多个特性都校验通过才能进入方法
        //与 
        //[Authorize("Product_Select")]
        //[Authorize("Product_Select_Page")]
        //与
        //[Authorize("Product_Select_Page/Product_Select")]
        [HttpPost]
        [Authorize("Product_Select")]
        public async Task<string> InsertProduct([FromBody]PermissionCreateDto product)
        {
            //return productService.InsertProduct(product);
            //AuthorizationResult authenticateResult = await _authorizationService.AuthorizeAsync(HttpContext.User, HttpContext, "Product_Select");
            //基于service授权
            //需要多个权限才能请求接口 ，二级权限
            //await AuthorizationService.CheckAsync("Product_Select_Page");
            //await AuthorizationService.AuthorizeAsync(HttpContext.User, HttpContext, "Product_Select");
            return "";
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<string> IgnoreAuthorize()
        {
            return "";
        }
    }
}
